﻿namespace WMS6.Web.Analytics
{
    using System;
    using System.Data;
    using System.Web.UI;
    using System.Web.UI.HtmlControls;
    using System.Web.UI.WebControls;
    using WMS6.Web;
    using WMS6.Web.AnalyticsReportServiceRef;
    using WMS6.Web.UserControls;

    public class ShipmentStatSplitCustomerRptList : BasePage
    {
        protected Button btnExport;
        protected Button btnList;
        protected Button btnRefresh;
        protected Button btnReSearch;
        protected Button btnSearch;
        protected HtmlForm F15481;
        protected GridView gvShipmentStatSplitCustomerRpt;
        protected GridView gvShipmentStatSplitCustomerRptShowDate;
        protected GridView gvShipmentStatSplitCustomerRptShowLot;
        protected GridView gvShipmentStatSplitCustomerRptShowLotShowDate;
        protected HtmlInputHidden hdnActionID;
        protected HtmlInputHidden hdnFrom;
        protected HtmlHead Head1;
        protected Label lblMsg;
        protected Label lblShipmentStatSplitCustomerRptList;
        protected Label lblTotal;
        protected Label lblTotalCube;
        protected Label lblTotalCubeText;
        protected Label lblTotalGrossWgt;
        protected Label lblTotalGrossWgtText;
        protected Label lblTotalQtyText;
        protected HtmlLink mycss;
        protected Pager PagerFooter;
        protected ScriptManager ScriptManager1;
        private decimal TotalCube;
        private decimal TotalGrossWgt;
        private decimal TotalQty;
        protected UpdatePanel up1;

        public void BindData2gvInOutStockList(ShipmentStatSplitCustomerRptQueryEntity shipmentStatSplitCustomerRptQueryEntity)
        {
            this.PagerFooter.CurrentPage = int.Parse(shipmentStatSplitCustomerRptQueryEntity.CurrentPage);
            DataSet ds = AnalyticsReportServiceClientProxy.GetInstance().GetShipmentStatSplitCustomerRptDataSet(shipmentStatSplitCustomerRptQueryEntity);
            this.CreateGridView(ds, shipmentStatSplitCustomerRptQueryEntity);
            if (shipmentStatSplitCustomerRptQueryEntity.IS_LOT == "Y")
            {
                if (shipmentStatSplitCustomerRptQueryEntity.SHOW_DATE == "N")
                {
                    base.BindData2GridView(this.gvShipmentStatSplitCustomerRptShowLot, ds);
                }
                else
                {
                    base.BindData2GridView(this.gvShipmentStatSplitCustomerRptShowLotShowDate, ds);
                }
            }
            else if (shipmentStatSplitCustomerRptQueryEntity.SHOW_DATE == "N")
            {
                base.BindData2GridView(this.gvShipmentStatSplitCustomerRpt, ds);
            }
            else
            {
                base.BindData2GridView(this.gvShipmentStatSplitCustomerRptShowDate, ds);
            }
            if ((ds != null) && (ds.Tables.Count > 1))
            {
                this.PagerFooter.PageInfo = ds.Tables[1].Rows[0]["CurrentPage"].ToString() + " / " + ds.Tables[1].Rows[0]["TotalPagesCount"].ToString() + "&nbsp;&nbsp;&nbsp;共: " + ds.Tables[1].Rows[0]["TotalRecordsCount"].ToString();
                this.PagerFooter.TotalPages = int.Parse(ds.Tables[1].Rows[0]["TotalPagesCount"].ToString());
            }
        }

        protected void btnExport_Click(object sender, EventArgs e)
        {
            ShipmentStatSplitCustomerRptQueryEntity shipmentStatSplitCustomerRptQueryEntity = this.GetShipmentStatSplitCustomerRptQueryEntity();
            shipmentStatSplitCustomerRptQueryEntity.IsGetAll = true;
            this.hdnActionID.Value = "EXPORT";
            string currentPageIndex = shipmentStatSplitCustomerRptQueryEntity.CurrentPage;
            shipmentStatSplitCustomerRptQueryEntity.CurrentPage = "0";
            if (shipmentStatSplitCustomerRptQueryEntity.IS_LOT == "Y")
            {
                if (shipmentStatSplitCustomerRptQueryEntity.SHOW_DATE == "N")
                {
                    this.gvShipmentStatSplitCustomerRptShowLot.Columns[1].Visible = false;
                    this.gvShipmentStatSplitCustomerRptShowLot.AllowSorting = false;
                    this.gvShipmentStatSplitCustomerRptShowLot.ShowFooter = false;
                }
                else
                {
                    this.gvShipmentStatSplitCustomerRptShowLotShowDate.Columns[1].Visible = false;
                    this.gvShipmentStatSplitCustomerRptShowLotShowDate.AllowSorting = false;
                    this.gvShipmentStatSplitCustomerRptShowLotShowDate.ShowFooter = false;
                }
            }
            else if (shipmentStatSplitCustomerRptQueryEntity.SHOW_DATE == "N")
            {
                this.gvShipmentStatSplitCustomerRpt.Columns[1].Visible = false;
                this.gvShipmentStatSplitCustomerRpt.AllowSorting = false;
                this.gvShipmentStatSplitCustomerRpt.ShowFooter = false;
            }
            else
            {
                this.gvShipmentStatSplitCustomerRptShowDate.Columns[1].Visible = false;
                this.gvShipmentStatSplitCustomerRptShowDate.AllowSorting = false;
                this.gvShipmentStatSplitCustomerRptShowDate.ShowFooter = false;
            }
            this.BindData2gvInOutStockList(shipmentStatSplitCustomerRptQueryEntity);
            shipmentStatSplitCustomerRptQueryEntity.IsGetAll = false;
            shipmentStatSplitCustomerRptQueryEntity.CurrentPage = currentPageIndex;
            this.SetShipmentStatSplitCustomerRptQueryEntity(shipmentStatSplitCustomerRptQueryEntity);
            if (shipmentStatSplitCustomerRptQueryEntity.IS_LOT == "Y")
            {
                if (shipmentStatSplitCustomerRptQueryEntity.SHOW_DATE == "N")
                {
                    base.Export2Excel("SshipmentStatSplitCustomerRpt.xls", this.gvShipmentStatSplitCustomerRptShowLot);
                }
                else
                {
                    base.Export2Excel("SshipmentStatSplitCustomerRpt.xls", this.gvShipmentStatSplitCustomerRptShowLotShowDate);
                }
            }
            else if (shipmentStatSplitCustomerRptQueryEntity.SHOW_DATE == "N")
            {
                base.Export2Excel("SshipmentStatSplitCustomerRpt.xls", this.gvShipmentStatSplitCustomerRpt);
            }
            else
            {
                base.Export2Excel("SshipmentStatSplitCustomerRpt.xls", this.gvShipmentStatSplitCustomerRptShowDate);
            }
        }

        protected void btnFirst_Click(object sender, EventArgs e)
        {
            ShipmentStatSplitCustomerRptQueryEntity shipmentStatSplitCustomerRptQueryEntity = this.GetShipmentStatSplitCustomerRptQueryEntity();
            shipmentStatSplitCustomerRptQueryEntity.CurrentPage = "0";
            this.BindData2gvInOutStockList(shipmentStatSplitCustomerRptQueryEntity);
        }

        protected void btnLast_Click(object sender, EventArgs e)
        {
            ShipmentStatSplitCustomerRptQueryEntity shipmentStatSplitCustomerRptQueryEntity = this.GetShipmentStatSplitCustomerRptQueryEntity();
            shipmentStatSplitCustomerRptQueryEntity.CurrentPage = (this.PagerFooter.TotalPages - 1).ToString();
            this.BindData2gvInOutStockList(shipmentStatSplitCustomerRptQueryEntity);
        }

        protected void btnList_Click(object sender, EventArgs e)
        {
            ShipmentStatSplitCustomerRptQueryEntity shipmentStatSplitCustomerRptQueryEntity = this.GetShipmentStatSplitCustomerRptQueryEntity();
            shipmentStatSplitCustomerRptQueryEntity.OWNER_ID = "";
            shipmentStatSplitCustomerRptQueryEntity.SKU_CLASS_ID = "";
            shipmentStatSplitCustomerRptQueryEntity.SKU_ID = "";
            shipmentStatSplitCustomerRptQueryEntity.ORDER_TYPE = "";
            shipmentStatSplitCustomerRptQueryEntity.StartTime = "";
            shipmentStatSplitCustomerRptQueryEntity.EndTime = "";
            shipmentStatSplitCustomerRptQueryEntity.LOT_ATTR01 = "";
            shipmentStatSplitCustomerRptQueryEntity.LOT_ATTR02 = "";
            shipmentStatSplitCustomerRptQueryEntity.LOT_ATTR03 = "";
            shipmentStatSplitCustomerRptQueryEntity.LOT_ATTR04 = "";
            shipmentStatSplitCustomerRptQueryEntity.LOT_ATTR05 = "";
            shipmentStatSplitCustomerRptQueryEntity.LOT_ATTR06 = "";
            shipmentStatSplitCustomerRptQueryEntity.LOT_ATTR07 = "";
            shipmentStatSplitCustomerRptQueryEntity.LOT_ATTR08 = "";
            shipmentStatSplitCustomerRptQueryEntity.LOT_ATTR09 = "";
            shipmentStatSplitCustomerRptQueryEntity.LOT_ATTR10 = "";
            shipmentStatSplitCustomerRptQueryEntity.EXPIRY_DATE = "";
            shipmentStatSplitCustomerRptQueryEntity.PRODUCE_DATE = "";
            shipmentStatSplitCustomerRptQueryEntity.EXTERNAL_LOT = "";
            shipmentStatSplitCustomerRptQueryEntity.CUSTOMER_ID = "";
            shipmentStatSplitCustomerRptQueryEntity.IS_LOT = "N";
            shipmentStatSplitCustomerRptQueryEntity.SHOW_DATE = "N";
            this.BindData2gvInOutStockList(shipmentStatSplitCustomerRptQueryEntity);
        }

        protected void btnNext_Click(object sender, EventArgs e)
        {
            ShipmentStatSplitCustomerRptQueryEntity shipmentStatSplitCustomerRptQueryEntity = this.GetShipmentStatSplitCustomerRptQueryEntity();
            if (int.Parse(shipmentStatSplitCustomerRptQueryEntity.CurrentPage) < (this.PagerFooter.TotalPages - 1))
            {
                shipmentStatSplitCustomerRptQueryEntity.CurrentPage = (int.Parse(shipmentStatSplitCustomerRptQueryEntity.CurrentPage) + 1).ToString();
                this.BindData2gvInOutStockList(shipmentStatSplitCustomerRptQueryEntity);
            }
        }

        protected void btnPrevious_Click(object sender, EventArgs e)
        {
            ShipmentStatSplitCustomerRptQueryEntity shipmentStatSplitCustomerRptQueryEntity = this.GetShipmentStatSplitCustomerRptQueryEntity();
            if (int.Parse(shipmentStatSplitCustomerRptQueryEntity.CurrentPage) > 0)
            {
                shipmentStatSplitCustomerRptQueryEntity.CurrentPage = (int.Parse(shipmentStatSplitCustomerRptQueryEntity.CurrentPage) - 1).ToString();
                this.BindData2gvInOutStockList(shipmentStatSplitCustomerRptQueryEntity);
            }
        }

        protected void btnRefresh_Click(object sender, EventArgs e)
        {
            ShipmentStatSplitCustomerRptQueryEntity shipmentStatSplitCustomerRptQueryEntity = this.GetShipmentStatSplitCustomerRptQueryEntity();
            this.BindData2gvInOutStockList(shipmentStatSplitCustomerRptQueryEntity);
        }

        private void CreateGridView(DataSet ds, ShipmentStatSplitCustomerRptQueryEntity shipmentStatSplitCustomerRptQueryEntity)
        {
            if (ds != null)
            {
                int iwidth;
                int i;
                DataRow[] dv;
                BoundField bf;
                DataSet dsCustomer = BaseInfoServiceClientProxy.GetInstance().GetAllInfo("CUSTOMER");
                if (ds.Tables.Count > 2)
                {
                    if (shipmentStatSplitCustomerRptQueryEntity.IS_LOT == "Y")
                    {
                        iwidth = 0x708;
                        if (shipmentStatSplitCustomerRptQueryEntity.SHOW_DATE == "N")
                        {
                            for (i = 20; (ds.Tables[2].Columns.Count - 1) > i; i++)
                            {
                                dv = dsCustomer.Tables[0].Select(" CUSTOMER_ID='" + ds.Tables[2].Columns[i].ColumnName + "'");
                                bf = new BoundField();
                                if (dv != null)
                                {
                                    bf.HeaderText = dv[0]["Company"].ToString();
                                }
                                else
                                {
                                    bf.HeaderText = ds.Tables[2].Columns[i].ToString();
                                }
                                bf.DataField = ds.Tables[2].Columns[i].ToString();
                                bf.SortExpression = ds.Tables[2].Columns[i].ToString();
                                this.gvShipmentStatSplitCustomerRptShowLot.Columns.Add(bf);
                                iwidth += 200;
                                this.gvShipmentStatSplitCustomerRptShowLot.Width = iwidth;
                            }
                        }
                        else
                        {
                            i = 0x15;
                            while ((ds.Tables[2].Columns.Count - 1) > i)
                            {
                                dv = dsCustomer.Tables[0].Select(" CUSTOMER_ID='" + ds.Tables[2].Columns[i].ColumnName + "'");
                                bf = new BoundField();
                                if (dv != null)
                                {
                                    bf.HeaderText = dv[0]["Company"].ToString();
                                }
                                else
                                {
                                    bf.HeaderText = ds.Tables[2].Columns[i].ToString();
                                }
                                bf.DataField = ds.Tables[2].Columns[i].ToString();
                                bf.SortExpression = ds.Tables[2].Columns[i].ToString();
                                this.gvShipmentStatSplitCustomerRptShowLotShowDate.Columns.Add(bf);
                                iwidth += 200;
                                this.gvShipmentStatSplitCustomerRptShowLotShowDate.Width = iwidth;
                                i++;
                            }
                        }
                    }
                    else
                    {
                        iwidth = 0x708;
                        if (shipmentStatSplitCustomerRptQueryEntity.SHOW_DATE == "N")
                        {
                            for (i = 15; (ds.Tables[2].Columns.Count - 1) > i; i++)
                            {
                                dv = dsCustomer.Tables[0].Select(" CUSTOMER_ID='" + ds.Tables[2].Columns[i].ColumnName + "'");
                                bf = new BoundField();
                                if (dv != null)
                                {
                                    bf.HeaderText = dv[0]["Company"].ToString();
                                }
                                else
                                {
                                    bf.HeaderText = ds.Tables[2].Columns[i].ToString();
                                }
                                bf.DataField = ds.Tables[2].Columns[i].ToString();
                                bf.SortExpression = ds.Tables[2].Columns[i].ToString();
                                this.gvShipmentStatSplitCustomerRpt.Columns.Add(bf);
                                iwidth += 200;
                                this.gvShipmentStatSplitCustomerRpt.Width = iwidth;
                            }
                        }
                        else
                        {
                            i = 0x10;
                            while ((ds.Tables[2].Columns.Count - 1) > i)
                            {
                                dv = dsCustomer.Tables[0].Select(" CUSTOMER_ID='" + ds.Tables[2].Columns[i].ColumnName + "'");
                                bf = new BoundField();
                                if (dv != null)
                                {
                                    bf.HeaderText = dv[0]["Company"].ToString();
                                }
                                else
                                {
                                    bf.HeaderText = ds.Tables[2].Columns[i].ToString();
                                }
                                bf.DataField = ds.Tables[2].Columns[i].ToString();
                                bf.SortExpression = ds.Tables[2].Columns[i].ToString();
                                this.gvShipmentStatSplitCustomerRptShowDate.Columns.Add(bf);
                                iwidth += 200;
                                this.gvShipmentStatSplitCustomerRptShowDate.Width = iwidth;
                                i++;
                            }
                        }
                    }
                }
                else if (ds.Tables.Count == 1)
                {
                    if (shipmentStatSplitCustomerRptQueryEntity.IS_LOT == "Y")
                    {
                        iwidth = 0x708;
                        if (shipmentStatSplitCustomerRptQueryEntity.SHOW_DATE == "N")
                        {
                            for (i = 20; ds.Tables[0].Columns.Count > i; i++)
                            {
                                dv = dsCustomer.Tables[0].Select(" CUSTOMER_ID='" + ds.Tables[0].Columns[i].ColumnName + "'");
                                bf = new BoundField();
                                if (dv != null)
                                {
                                    bf.HeaderText = dv[0]["Company"].ToString();
                                }
                                else
                                {
                                    bf.HeaderText = ds.Tables[0].Columns[i].ToString();
                                }
                                bf.DataField = ds.Tables[0].Columns[i].ToString();
                                bf.SortExpression = ds.Tables[0].Columns[i].ToString();
                                this.gvShipmentStatSplitCustomerRptShowLot.Columns.Add(bf);
                                iwidth += 200;
                                this.gvShipmentStatSplitCustomerRptShowLot.Width = iwidth;
                            }
                        }
                        else
                        {
                            i = 0x15;
                            while (ds.Tables[0].Columns.Count > i)
                            {
                                dv = dsCustomer.Tables[0].Select(" CUSTOMER_ID='" + ds.Tables[0].Columns[i].ColumnName + "'");
                                bf = new BoundField();
                                if (dv != null)
                                {
                                    bf.HeaderText = dv[0]["Company"].ToString();
                                }
                                else
                                {
                                    bf.HeaderText = ds.Tables[0].Columns[i].ToString();
                                }
                                bf.DataField = ds.Tables[0].Columns[i].ToString();
                                bf.SortExpression = ds.Tables[0].Columns[i].ToString();
                                this.gvShipmentStatSplitCustomerRptShowLotShowDate.Columns.Add(bf);
                                iwidth += 200;
                                this.gvShipmentStatSplitCustomerRptShowLotShowDate.Width = iwidth;
                                i++;
                            }
                        }
                    }
                    else
                    {
                        iwidth = 0x708;
                        if (shipmentStatSplitCustomerRptQueryEntity.SHOW_DATE == "N")
                        {
                            for (i = 15; ds.Tables[0].Columns.Count > i; i++)
                            {
                                dv = dsCustomer.Tables[0].Select(" CUSTOMER_ID='" + ds.Tables[0].Columns[i].ColumnName + "'");
                                bf = new BoundField();
                                if (dv != null)
                                {
                                    bf.HeaderText = dv[0]["Company"].ToString();
                                }
                                else
                                {
                                    bf.HeaderText = ds.Tables[0].Columns[i].ToString();
                                }
                                bf.DataField = ds.Tables[0].Columns[i].ToString();
                                bf.SortExpression = ds.Tables[0].Columns[i].ToString();
                                this.gvShipmentStatSplitCustomerRpt.Columns.Add(bf);
                                iwidth += 200;
                                this.gvShipmentStatSplitCustomerRpt.Width = iwidth;
                            }
                        }
                        else
                        {
                            for (i = 0x10; ds.Tables[0].Columns.Count > i; i++)
                            {
                                dv = dsCustomer.Tables[0].Select(" CUSTOMER_ID='" + ds.Tables[0].Columns[i].ColumnName + "'");
                                bf = new BoundField();
                                if (dv != null)
                                {
                                    bf.HeaderText = dv[0]["Company"].ToString();
                                }
                                else
                                {
                                    bf.HeaderText = ds.Tables[0].Columns[i].ToString();
                                }
                                bf.DataField = ds.Tables[0].Columns[i].ToString();
                                bf.SortExpression = ds.Tables[0].Columns[i].ToString();
                                this.gvShipmentStatSplitCustomerRptShowDate.Columns.Add(bf);
                                iwidth += 200;
                                this.gvShipmentStatSplitCustomerRptShowDate.Width = iwidth;
                            }
                        }
                    }
                }
            }
        }

        private ShipmentStatSplitCustomerRptQueryEntity GetShipmentStatSplitCustomerRptQueryEntity()
        {
            return (base.PageQueryEntitySession as ShipmentStatSplitCustomerRptQueryEntity);
        }

        protected void GoTo_Click(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(((TextBox) this.PagerFooter.FindControl("txtGo2Page")).Text.Trim()))
            {
                ShipmentStatSplitCustomerRptQueryEntity shipmentStatSplitCustomerRptQueryEntity = this.GetShipmentStatSplitCustomerRptQueryEntity();
                shipmentStatSplitCustomerRptQueryEntity.CurrentPage = this.PagerFooter.GoToPage.ToString();
                this.BindData2gvInOutStockList(shipmentStatSplitCustomerRptQueryEntity);
            }
        }

        protected void gvShipmentStatSplitCustomerRpt_Init(object sender, EventArgs e)
        {
            base.InitDetailGridView("F15481", this.gvShipmentStatSplitCustomerRpt);
        }

        protected void gvShipmentStatSplitCustomerRpt_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                e.Row.Cells[0].Text = (((this.PagerFooter.CurrentPage * this.PagerFooter.PageSize) + e.Row.RowIndex) + 1).ToString();
                e.Row.Attributes.Add("onmouseout", "GridViewRowMouseout(this);");
                e.Row.Attributes.Add("onmouseover", "GridViewRowMouseover(this);");
                ((CheckBox) e.Row.FindControl("chbSelect")).Attributes.Add("onclick", "GridViewCheckBoxClick('" + e.Row.ClientID + "')");
                e.Row.Attributes.Add("ondblclick", "JavaScript:document.getElementById('" + ((CheckBox) e.Row.FindControl("chbSelect")).ClientID + "').click();");
                if (this.hdnActionID.Value != "EXPORT")
                {
                    base.SetGridViewLongTextLabel((Label) e.Row.FindControl("lblSkuDescr"));
                }
                if (((Label) e.Row.FindControl("lblQTY")) != null)
                {
                    this.TotalQty += decimal.Parse((((Label) e.Row.FindControl("lblQTY")).Text != "") ? ((Label) e.Row.FindControl("lblQTY")).Text : "0");
                }
                if (((Label) e.Row.FindControl("lblGrossWgt")) != null)
                {
                    this.TotalGrossWgt += decimal.Parse((((Label) e.Row.FindControl("lblGrossWgt")).Text != "") ? ((Label) e.Row.FindControl("lblGrossWgt")).Text : "0");
                }
                if (((Label) e.Row.FindControl("lblCube")) != null)
                {
                    this.TotalCube += decimal.Parse((((Label) e.Row.FindControl("lblCube")).Text != "") ? ((Label) e.Row.FindControl("lblCube")).Text : "0");
                }
            }
            if (e.Row.RowType == DataControlRowType.Footer)
            {
                this.lblTotalQtyText.Text = base.GetPreferenceDigit(this.TotalQty);
                this.lblTotalGrossWgtText.Text = base.GetPreferenceDigit(this.TotalGrossWgt);
                this.lblTotalCubeText.Text = base.GetPreferenceDigit(this.TotalCube);
            }
        }

        protected void gvShipmentStatSplitCustomerRpt_Sorting(object sender, GridViewSortEventArgs e)
        {
            try
            {
                ShipmentStatSplitCustomerRptQueryEntity shipmentStatSplitCustomerRptQueryEntity = this.GetShipmentStatSplitCustomerRptQueryEntity();
                shipmentStatSplitCustomerRptQueryEntity.SortField = e.SortExpression;
                if (shipmentStatSplitCustomerRptQueryEntity.SortDirection == "ASC")
                {
                    shipmentStatSplitCustomerRptQueryEntity.SortDirection = "DESC";
                }
                else if (shipmentStatSplitCustomerRptQueryEntity.SortDirection == "DESC")
                {
                    shipmentStatSplitCustomerRptQueryEntity.SortDirection = "ASC";
                }
                this.BindData2gvInOutStockList(shipmentStatSplitCustomerRptQueryEntity);
            }
            catch (Exception ex)
            {
                this.lblMsg.Text = ex.Message;
            }
        }

        protected void gvShipmentStatSplitCustomerRptShowDate_Init(object sender, EventArgs e)
        {
            base.InitDetailGridView("F15481", this.gvShipmentStatSplitCustomerRptShowDate);
        }

        protected void gvShipmentStatSplitCustomerRptShowLot_Init(object sender, EventArgs e)
        {
            base.InitDetailGridView("F15481", this.gvShipmentStatSplitCustomerRptShowLot);
        }

        protected void gvShipmentStatSplitCustomerRptShowLotShowDate_Init(object sender, EventArgs e)
        {
            base.InitDetailGridView("F15481", this.gvShipmentStatSplitCustomerRptShowLotShowDate);
        }

        private void LoadData()
        {
            ShipmentStatSplitCustomerRptQueryEntity shipmentStatSplitCustomerRptQueryEntity = new ShipmentStatSplitCustomerRptQueryEntity();
            if (string.IsNullOrEmpty(base.Request.QueryString["from"]))
            {
                if (this.PreviousPage != null)
                {
                    shipmentStatSplitCustomerRptQueryEntity.OWNER_ID = this.PreviousPage.OwnerID;
                    shipmentStatSplitCustomerRptQueryEntity.SKU_CLASS_ID = this.PreviousPage.SkuClassID;
                    shipmentStatSplitCustomerRptQueryEntity.SKU_ID = this.PreviousPage.SkuID;
                    shipmentStatSplitCustomerRptQueryEntity.ORDER_TYPE = this.PreviousPage.OrderType;
                    shipmentStatSplitCustomerRptQueryEntity.StartTime = this.PreviousPage.StartTime;
                    shipmentStatSplitCustomerRptQueryEntity.EndTime = this.PreviousPage.EndTime;
                    shipmentStatSplitCustomerRptQueryEntity.LOT_ATTR01 = this.PreviousPage.LotAttribute01;
                    shipmentStatSplitCustomerRptQueryEntity.LOT_ATTR02 = this.PreviousPage.LotAttribute02;
                    shipmentStatSplitCustomerRptQueryEntity.LOT_ATTR03 = this.PreviousPage.LotAttribute03;
                    shipmentStatSplitCustomerRptQueryEntity.LOT_ATTR04 = this.PreviousPage.LotAttribute04;
                    shipmentStatSplitCustomerRptQueryEntity.LOT_ATTR05 = this.PreviousPage.LotAttribute05;
                    shipmentStatSplitCustomerRptQueryEntity.LOT_ATTR06 = this.PreviousPage.LotAttribute06;
                    shipmentStatSplitCustomerRptQueryEntity.LOT_ATTR07 = this.PreviousPage.LotAttribute07;
                    shipmentStatSplitCustomerRptQueryEntity.LOT_ATTR08 = this.PreviousPage.LotAttribute08;
                    shipmentStatSplitCustomerRptQueryEntity.LOT_ATTR09 = this.PreviousPage.LotAttribute09;
                    shipmentStatSplitCustomerRptQueryEntity.LOT_ATTR10 = this.PreviousPage.LotAttribute10;
                    shipmentStatSplitCustomerRptQueryEntity.EXPIRY_DATE = this.PreviousPage.ExpiryDate;
                    shipmentStatSplitCustomerRptQueryEntity.PRODUCE_DATE = this.PreviousPage.ProduceDate;
                    shipmentStatSplitCustomerRptQueryEntity.EXTERNAL_LOT = this.PreviousPage.ExternalLot;
                    shipmentStatSplitCustomerRptQueryEntity.CUSTOMER_ID = this.PreviousPage.CustomerID;
                    shipmentStatSplitCustomerRptQueryEntity.IS_LOT = this.PreviousPage.isLot;
                    shipmentStatSplitCustomerRptQueryEntity.SHOW_DATE = this.PreviousPage.ShowDate;
                }
                else
                {
                    shipmentStatSplitCustomerRptQueryEntity.OWNER_ID = "";
                    shipmentStatSplitCustomerRptQueryEntity.SKU_CLASS_ID = "";
                    shipmentStatSplitCustomerRptQueryEntity.SKU_ID = "";
                    shipmentStatSplitCustomerRptQueryEntity.ORDER_TYPE = "";
                    shipmentStatSplitCustomerRptQueryEntity.StartTime = "";
                    shipmentStatSplitCustomerRptQueryEntity.EndTime = "";
                    shipmentStatSplitCustomerRptQueryEntity.LOT_ATTR01 = "";
                    shipmentStatSplitCustomerRptQueryEntity.LOT_ATTR02 = "";
                    shipmentStatSplitCustomerRptQueryEntity.LOT_ATTR03 = "";
                    shipmentStatSplitCustomerRptQueryEntity.LOT_ATTR04 = "";
                    shipmentStatSplitCustomerRptQueryEntity.LOT_ATTR05 = "";
                    shipmentStatSplitCustomerRptQueryEntity.LOT_ATTR06 = "";
                    shipmentStatSplitCustomerRptQueryEntity.LOT_ATTR07 = "";
                    shipmentStatSplitCustomerRptQueryEntity.LOT_ATTR08 = "";
                    shipmentStatSplitCustomerRptQueryEntity.LOT_ATTR09 = "";
                    shipmentStatSplitCustomerRptQueryEntity.LOT_ATTR10 = "";
                    shipmentStatSplitCustomerRptQueryEntity.EXPIRY_DATE = "";
                    shipmentStatSplitCustomerRptQueryEntity.PRODUCE_DATE = "";
                    shipmentStatSplitCustomerRptQueryEntity.EXTERNAL_LOT = "";
                    shipmentStatSplitCustomerRptQueryEntity.CUSTOMER_ID = "";
                    shipmentStatSplitCustomerRptQueryEntity.IS_LOT = "N";
                    shipmentStatSplitCustomerRptQueryEntity.SHOW_DATE = "N";
                }
            }
            else
            {
                this.hdnFrom.Value = base.Request.QueryString["from"].ToString();
            }
            if (shipmentStatSplitCustomerRptQueryEntity.IS_LOT == "Y")
            {
                if (shipmentStatSplitCustomerRptQueryEntity.SHOW_DATE == "N")
                {
                    shipmentStatSplitCustomerRptQueryEntity.PageSize = this.gvShipmentStatSplitCustomerRptShowLot.PageSize.ToString();
                    this.PagerFooter.PageSize = this.gvShipmentStatSplitCustomerRptShowLot.PageSize;
                }
                else
                {
                    shipmentStatSplitCustomerRptQueryEntity.PageSize = this.gvShipmentStatSplitCustomerRptShowLotShowDate.PageSize.ToString();
                    this.PagerFooter.PageSize = this.gvShipmentStatSplitCustomerRptShowLotShowDate.PageSize;
                }
            }
            else if (shipmentStatSplitCustomerRptQueryEntity.SHOW_DATE == "N")
            {
                shipmentStatSplitCustomerRptQueryEntity.PageSize = this.gvShipmentStatSplitCustomerRpt.PageSize.ToString();
                this.PagerFooter.PageSize = this.gvShipmentStatSplitCustomerRpt.PageSize;
            }
            else
            {
                shipmentStatSplitCustomerRptQueryEntity.PageSize = this.gvShipmentStatSplitCustomerRptShowDate.PageSize.ToString();
                this.PagerFooter.PageSize = this.gvShipmentStatSplitCustomerRptShowDate.PageSize;
            }
            shipmentStatSplitCustomerRptQueryEntity.IsGetAll = false;
            shipmentStatSplitCustomerRptQueryEntity.CurrentPage = "0";
            shipmentStatSplitCustomerRptQueryEntity.SortField = " OWNER_ID,SKU_ID";
            shipmentStatSplitCustomerRptQueryEntity.SortDirection = "ASC";
            this.SetShipmentStatSplitCustomerRptQueryEntity(shipmentStatSplitCustomerRptQueryEntity);
            this.BindData2gvInOutStockList(shipmentStatSplitCustomerRptQueryEntity);
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!base.IsPostBack)
            {
                base.InitAnalyticsReportGridview(this.gvShipmentStatSplitCustomerRptShowDate);
                base.InitAnalyticsReportGridview(this.gvShipmentStatSplitCustomerRptShowLot);
                base.InitAnalyticsReportGridview(this.gvShipmentStatSplitCustomerRptShowLotShowDate);
                base.InitAnalyticsReportGridview(this.gvShipmentStatSplitCustomerRpt);
                base.InitPage(this.Page);
                this.LoadData();
            }
        }

        public void SetShipmentStatSplitCustomerRptQueryEntity(ShipmentStatSplitCustomerRptQueryEntity shipmentStatSplitCustomerRptQueryEntity)
        {
            base.PageQueryEntitySession = shipmentStatSplitCustomerRptQueryEntity;
        }

        public ShipmentStatSplitCustomerRptQuery PreviousPage
        {
            get
            {
                return (ShipmentStatSplitCustomerRptQuery) base.PreviousPage;
            }
        }
    }
}

